local mou__xueyi = fk.CreateSkill {

  name = "joy_mou__xueyi$",

  tags = { Skill.Compulsory, },

}



mou__xueyi:addEffect(fk.TargetSpecified, {
  name = "joy_mou__xueyi$",
  anim_type = "drawcard",
  events = {fk.TargetSpecified},
  frequency = Skill.Compulsory,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(mou__xueyi.name) and target == player and player:usedSkillTimes(mou__xueyi.name) < 2 and
    data.to ~= player.id and player.room:getPlayerById(data.to).kingdom == "qun"
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(1, mou__xueyi.name)
  end,
})

mou__xueyi:addEffect("maxcards", {
  name = "#joy_mou__xueyi_maxcards",
  correct_func = function(self, player)
    if player:hasSkill(mou__xueyi.name) then
      local hmax = 0
      for _, p in ipairs(Fk:currentRoom().alive_players) do
        if  p.kingdom == "qun" then
          hmax = hmax + 1
        end
      end
      return hmax *2
    else
      return 0
    end
  end,
})

return mou__xueyi